/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Interpreter.Function.Database;

import Interpreter.Observation;
import Interpreter.Function.Function;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Stephen
 */
public class ReadLatestEncounterFunction extends Function{
    
    @Override
    public Object execute(ArrayList args) {
        return getObs();
    }
    
    private ArrayList getObs() {
        ArrayList myObs = new ArrayList();
        SimpleDateFormat dateFormat = new SimpleDateFormat("EEE MMM dd kk:mm:ss z yyyy");
        Calendar cal = Calendar.getInstance();
        Date day;
        try {
            cal.setTime(dateFormat.parse("Sat Apr 13 10:45:08 PDT 2013"));
            day = cal.getTime();
            myObs.add(new Observation(day, "weight", 130.3, "float"));
            
            cal.setTime(dateFormat.parse("Sat Apr 11 10:45:08 PDT 2013"));
            day = cal.getTime();
            myObs.add(new Observation(day, "weight", 110.3, "float"));
            
            cal.setTime(dateFormat.parse("Sat Apr 14 10:45:08 PDT 2013"));
            day = cal.getTime();
            myObs.add(new Observation(day, "weight", 140.3, "float"));
            
            cal.setTime(dateFormat.parse("Sat Apr 12 10:45:08 PDT 2013"));
            day = cal.getTime();
            myObs.add(new Observation(day, "weight", 120.3, "float"));
        } catch (ParseException ex) {
            Logger.getLogger(ReadFunction.class.getName()).log(Level.SEVERE, null, ex);
        }
        
        return myObs;
    }
}
